package main

import "fmt"

func main() {
	chan1 := make(chan int)
	chan2 := make(chan int)

	go func() {
		for x := 0; x<=3; x++ {
			chan1 <- x
		}
		close(chan1)
	}()

	go func() {
		for x:=range chan1{
			chan2<-x*x
		}
		close(chan2)
	}()

	for y:=range chan2{
		fmt.Println(y)
	}
}
